﻿namespace System.Collections.Concurrent
{
    /// <summary>
    /// Concurrent扩展类
    /// </summary>
    public static class ConcurrentEx
    {
        /// <summary>
        /// 清空ConcurrentBag集合
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="items">集合</param>
        public static void Clear<T>(this ConcurrentBag<T> items)
        {
            T item;
            while (items.TryTake(out item))
            {

            }
        }
    }

}
